package cn.nami.web.util;

import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;

public class JsonUtil
{
	private JsonUtil(){};

	public static String toJson(Object obj)
	{
		Gson gson = new Gson();
		return gson.toJson(obj);
	}
	
	public static void setJsonHeader(HttpServletResponse response)
	{
		response.setContentType("application/x-json; charset=UTF-8");
		response.setCharacterEncoding("UTF-8");
	}
	
	public static void main(String[] args)
	{
		System.out.println(toJson(null));
	}
}